/**
 * 存放请求
 */
import http, { type CatsTree, type First , type UserList } from '@/api'


// 首页
export function getFirstList(){
    return http.get<First.myFirst>('classify')
}

// 搜索页 的请求
export function getSearchNewGoodsList(params:{_page:number;_limit:number}){
    return http.get<CatsTree.goodsItem>('newgoods',params)
}

export function getSearchSellGoodsList(params:{_page:number;_limit:number}){
    return http.get<CatsTree.goodsItem>('sellgoods',params)
}

export function getSearchSynGoodsList(params:{_page:number;_limit:number}){
    return http.get<CatsTree.goodsItem>('syngoods',params)
}

// 获取全部数据

export function getSearchNewGoodsListAll(){
    return http.get<CatsTree.goodsItem>('newgoods')
}

export function getSearchSellGoodsListAll(){
    return http.get<CatsTree.goodsItem>('sellgoods')
}

export function getSearchSynGoodsListAll(){
    return http.get<CatsTree.goodsItem>('syngoods')
}

// TreeSelect
export function getTreeSelect(){
    return http.get<CatsTree.goodsTree>('catstree')

}

//获取用户信息
export function getUserInfoList(){
    return http.get<UserList.Item>('userinfo')
}
//添加用户信息
export function getUserInfoPost(data:UserList.Item){
    return http.post<UserList.Item>('userinfo',data)
}


// 添加至购物车
export function setCartGoodsList(data:CatsTree.myGoods){
    return http.post<CatsTree.goodsItem>('cartgoods',data)
}

// 获取购物车
export function getCartGoodsList(){
    return http.get<CatsTree.goodsItem>('cartgoods')
}